首页 \ 问答 \ XML包含多个名称空间 - 但它只有一个(The XML contains multiple namespaces - but it only has one)

XML包含多个名称空间 - 但它只有一个(The XML contains multiple namespaces - but it only has one)

我正在使用SSIS导入XML文件。

当我尝试生成XSD时,它显示错误:

无法从XML文件中推断出XSD。 XML包含多个名称空间

这是XML文件的一个非常基本的清理版本:

<?xml version="1.0"?> 
<SM>  
  <xF>     
    <MA xmlns="http://www.somewhere.com/ZZ/ZZ.xsd">
  </SM>  
  .... other stuff ...
</xF>     

它肯定只有一个xmlns= ,它没有命名空间限定符,有点像这样:

无法从XML文件推断XSD .XML包含多个命名空间

....除了没有命名空间限定符(文件中唯一的:在URL中)

如果它只有一个xmlns= ,那是不是意味着它只有一个命名空间,而不是很多?

如果存在某种“固有”命名空间,则意味着SSIS无法导入任何带有xmlns=声明的xml文件。

任何人都可以澄清:一个只有一个xmlns=的XML文件有多少名称空间? 是否有一个我可以使用的工具,它将枚举命名空间,以便我可以识别它们?

有许多在线解决方案说“用xlst删除xmlns”但我宁愿首先理解为什么SSIS认为它有多个命名空间。

如果我删除xmlns部分,生成XSD并导入它导入OK。 如果我将xmlns保留并使用现有XSD导入,则不会导入任何行。 我认为这是因为XSD需要引用命名空间,但如果我将targetNamespace放入XSD,它仍然不会导入任何行。 也许我需要找一个非SSIS XML工具来做一些调查。


I'm using SSIS to import XML files.

When I try to generate XSD it shows the error:

Unable to infer the XSD from the XML file. The XML contains multiple namespaces

Here a very basic sanitised version of the XML file:

<?xml version="1.0"?> 
<SM>  
  <xF>     
    <MA xmlns="http://www.somewhere.com/ZZ/ZZ.xsd">
  </SM>  
  .... other stuff ...
</xF>     

It definitely only has one xmlns= in it, and it has no namespace qualifiers, a bit like this:

Unable to infer XSD from XML file .XML contain Multiple Namespaces

....except that there are no namespace qualifiers (the only : in the file is in the URL)

If it only has one xmlns= in it, doesn't that mean it only has one namespace, not many?

If there is some kind of 'inherent' namespace, that means that SSIS is unable to import any xml file with a xmlns= declaration in it.

Can anyone clarify: how many namespaces does an XML file with only one xmlns= in it have? Is there a tool I can use that will enumerate the namespaces so I can identify them?

There are many online solutions that say "remove the xmlns with xlst" but I would rather first understand why SSIS thinks it has multiple namespaces.

If I remove the xmlns part, generate the XSD and import it imports OK. If I leave the xmlns in and import with the existing XSD it imports no rows. I think this is because the XSD needs to refer to the namespace, but if I put targetNamespace into the XSD, it still imports no rows. Perhaps I need to find a non SSIS XML tool to do some investigation.


原文:https://stackoverflow.com/questions/32961930
更新时间:2021-12-01 17:12

最满意答案

Vue正在挂钩原生活动。 jQuery在本机事件之上的层中生成事件。 有关如何使用document.createEvent创建和分派本机事件的更多信息,请参阅此处:

https://learn.jquery.com/events/triggering-event-handlers/

这里有一个很好的例子: 是否可以通过编程方式模拟按键事件?


Vue is hooking native events. jQuery is generating events in a layer above native events. See this for more information on how to use document.createEvent to create and dispatch native events:

https://learn.jquery.com/events/triggering-event-handlers/

There's a good example here: Is it possible to simulate key press events programmatically?

相关问答

更多
  • Vue正在挂钩原生活动。 jQuery在本机事件之上的层中生成事件。 有关如何使用document.createEvent创建和分派本机事件的更多信息,请参阅此处: https://learn.jquery.com/events/triggering-event-handlers/ 这里有一个很好的例子: 是否可以通过编程方式模拟按键事件? Vue is hooking native events. jQuery is generating events in a layer above native ev ...
  • 从文档中 ,使用self事件修饰符仅捕获源自元素本身的事件...
    new Vue({ el: '#app', methods: { do_X () { console.log(Date.now(), 'do_X') } } }) #largeArea { padding: 20px; border: 1px solid black; }