首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在XML中,节点之前的"tg:“意味着什么?

在XML中,节点之前的"tg:“意味着什么?
EN

Stack Overflow用户
提问于 2015-01-09 10:42:07
回答 1查看 146关注 0票数 0

我有一个来自需要匹配的外部系统的XML示例。然而,示例XML具有以下格式;

代码语言:javascript
复制
<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的一部分,还是来自另一个系统?谢谢大家!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-09 11:06:54

它是相关模式的命名空间的前缀。每个xml文档可能包含名称空间,也可能不包含名称空间。

应该声明名称空间和相关前缀,通常在根元素中,例如:

代码语言:javascript
复制
<root xmlns:tg="http://www.w3.org/TR/html4/theTGprefixnamespace">

在此之后,属于名称空间的任何元素都应该在其名称前加上前缀:

代码语言:javascript
复制
<root xmlns:tg="http://www.w3.org/TR/html4/theTGprefixnamespace">
    <tg:item />
</root>

相关阅读从w3schools

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27858786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档