我有一个来自需要匹配的外部系统的XML示例。然而,示例XML具有以下格式;
<tg:order tg:job_id="SC10268" tg:site_code="SC" tg:replace="true">
<tg:job_description>STJ Import - AUG 2007</tg:job_description>
<tg:order_qty>176277</tg:order_qty>
<!-- finishing style should be WS for saddle stitched or PB for perfect bound -->
<tg:finishing_style>PB</tg:finishing_style>
<!-- overall finished trim size and extent -->
<tg:depth>8.25</tg:depth>
<tg:width>10.875</tg:width>
<tg:cover_pagination>4</tg:cover_pagination>
<tg:text_pagination>240</tg:text_pagination>
<!-- deadline dates for the job are specified here -->
<tg:delivery_commence_date>2007-11-04</tg:delivery_commence_date>
<tg:delivery_complete_date>2007-11-05</tg:delivery_complete_date>
<!-- job site and managing printer should default to your site code we set up for the trial -->
<tg:job_site>SC</tg:job_site>
<tg:managing_printer>SC</tg:managing_printer>
<!-- job site and managing printer should default to true for the trial -->
<tg:is_managing_printer>true</tg:is_managing_printer>
<!-- customer purchase order reference if known -->
<tg:cust_order_ref>776030</tg:cust_order_ref>
<!-- customer code should be a unique reference that we will use to add customer detail and avoid duplicates -->
<!-- see seperate company import specification for further company details -->
<!-- Customer code MUST match an CompanyShortCode in the Company DB -->
<tg:cust_code>Sears</tg:cust_code>
<!-- add as many job related contacts as you need -->
<tg:cust_contact tg:cust_contact_code="jill.summers@sears.com"/>
<tg:cust_contact tg:cust_contact_code="simon.caldwell@sears.com"/>
<!-- account exec / CSR details - the email address will be used as a unique key to avoid duplicates -->
<!-- we will add new CSR's (based on email address to the list of available CSR's -->
<tg:site_cce_name>Cathy Noble</tg:site_cce_name>
<tg:site_cce_phone>(847) 466 1008</tg:site_cce_phone>
<tg:site_cce_mobile>(847) 477 2008</tg:site_cce_mobile>
<tg:site_cce_email>cathy.noble@superior.com</tg:site_cce_email>
<!-- sales rep details - the email address will be used as a unique key to avoid duplicates -->
<!-- we will add new sales reps (based on email address to the list of available sales reps -->
<tg:sales_person_name>Sam Brown</tg:sales_person_name>
<tg:sales_person_phone>(847) 466 1001</tg:sales_person_phone>
<tg:sales_person_mobile>(847) 477 2001</tg:sales_person_mobile>
<tg:sales_person_email>sam.brown@superior.com</tg:sales_person_email>
</tg:order>每个节点之前的"tg:“是什么意思?这是XML的一部分,还是来自另一个系统?谢谢大家!
发布于 2015-01-09 11:06:54
它是相关模式的命名空间的前缀。每个xml文档可能包含名称空间,也可能不包含名称空间。
应该声明名称空间和相关前缀,通常在根元素中,例如:
<root xmlns:tg="http://www.w3.org/TR/html4/theTGprefixnamespace">在此之后,属于名称空间的任何元素都应该在其名称前加上前缀:
<root xmlns:tg="http://www.w3.org/TR/html4/theTGprefixnamespace">
<tg:item />
</root>相关阅读从w3schools。
https://stackoverflow.com/questions/27858786
复制相似问题