标签: xml-namespaces

这个特定的XML文件中的xmlns是什么?

我有一个条目servlet.xml,

xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr
Run Code Online (Sandbox Code Playgroud)

现在,我认为,dwr是我们要使用的前缀,比如

<dwr:configuration>
    <dwr:convert type="bean" class="com.abc.bean.MyBean" />
</dwr:configuration>
Run Code Online (Sandbox Code Playgroud)

现在问题是,如果网站http://www.directwebremoting.org关闭,那么我的应用程序无法创建bean.

  • 每当beanfactory创建bean时,它会打到这个网站吗?

  • 有没有其他选择,以便我可以使用dwr,而无需访问他们的网站?


完整标题:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
       http://www.springframework.org/schema/aop 
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
       http://www.directwebremoting.org/schema/spring-dwr 
       http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"> 
Run Code Online (Sandbox Code Playgroud)

java xml xml-namespaces

5
推荐指数
2
解决办法
5850
查看次数

使用JavaScript删除XML命名空间的简单方法?

例如,是否有一种简单的方法来删除XML名称空间,但保持jQuery或JavaScript的标记不变?例如:

<html:a href="#an-example" title="Go to the example">Just an Example</html:a>
Run Code Online (Sandbox Code Playgroud)

并将其更改为:

<a href="#an-example" title="Go to the example">Just an Example</a>
Run Code Online (Sandbox Code Playgroud)

使用jQuery或JavaScript实时运行,并且不知道其中的元素和/或属性?

html javascript jquery namespaces xml-namespaces

5
推荐指数
1
解决办法
3468
查看次数

WPF - <?mapping>是否已被使用?

基本上,我记得曾经有一段时间你可以使用以下内容:( <?Mapping ... >它似乎不再起作用了 - 也许是贬值了?)

我知道我可以像我这样映射我的XML命名空间......

xmlns:xyzcon="clr-namespace:XYZ.Wpf.Controls"
xmlns:xyzcom="clr-namespace:XYZ.Wpf.Commands"
Run Code Online (Sandbox Code Playgroud)

但是,我也知道我可以映射我的XML命名空间(更清洁)

[assembly: XmlnsPrefix("http://schemas.mycompany.com/netfx/xaml/presentation", "xyz")]
[assembly: XmlnsDefinition("http://schemas.mycompany.com/netfx/xaml/presentation", "XYZ.Wpf.Controls")]
[assembly: XmlnsDefinition("http://schemas.mycompany.com/netfx/xaml/presentation", "XYZ.Wpf.Commands")]
Run Code Online (Sandbox Code Playgroud)

这使得它非常容易使用,因为相反具有l,lv等前缀我可以让我所有的CLR命名空间指向相同的XML命名空间...

xmlns:xyz="http://schemas.mycompany.com/netfx/xaml/presentation"
Run Code Online (Sandbox Code Playgroud)

该行使我可以访问XYZ.Wpf.Controls和XYZ.Wpf.Commands.问题是这只有在程序集已经编译时才有效.在同一个程序集中工作时,我无法使用此技巧.

基本上,在同一个应用程序或程序集中,我想在全局范围内将不同的CLR命名空间映射到SAME XML命名空间(在整个我的应用程序中,我只需要包含一个XML命名空间).有办法吗?

wpf assemblies namespaces xml-namespaces

5
推荐指数
1
解决办法
304
查看次数

找不到类型或命名空间名称(XAML新增功能)

所以我正在尝试使用Visual Studio 2012在XAML文档上创建一个非常简单的骰子应用程序,但我无法弄清楚如何处理错误.我尝试使用bitmapimage添加; 但它仍然行不通.

以下是我得到的错误:

Error   1   Undefined namespace. The 'using' URI refers to a namespace 'DiceRoll' that could not be found.
Error   2   The type or namespace name 'BitmapImage' could not be found (are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)

CS:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using BitmapImage;

// The Blank Page item template is …
Run Code Online (Sandbox Code Playgroud)

c# xml xaml xml-namespaces visual-studio-2012

5
推荐指数
1
解决办法
1万
查看次数

从xml的根元素中删除特定的xmlns

我正在尝试为XML文档进行转换,但由于我不了解XSLT,因此无法找到解决方案.我有XML文档:

<?xml version="1.0" encoding="UTF-8"?>
<addresses xmlns="http://www.test.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation='http://whatever/test.xsd'>

  <address>
    <name>Joe Tester</name>
    <street>Baker street 5</street>
  </address>

</addresses>
Run Code Online (Sandbox Code Playgroud)

我想生产:

<?xml version="1.0" encoding="UTF-8"?>
<addresses xmlns="http://www.test.org/xml">

  <address>
    <name>Joe Tester</name>
    <street>Baker street 5</street>
  </address>

</addresses>
Run Code Online (Sandbox Code Playgroud)

(考虑到xsi:noNamespaceSchemaLocation ="..."已经在此之前使用另一个XSLT排除了).

有人可以帮我找到解决方案吗?

用于消除xsi:noNamespaceSchemaLocation的XSLT是:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>

<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="@* | node()">
 <xsl:copy>
  <xsl:apply-templates select="@* | node()" />
 </xsl:copy>
</xsl:template>

<xsl:template match="@xsi:noNamespaceSchemaLocation"/>

</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

xml xslt xml-namespaces

5
推荐指数
0
解决办法
1万
查看次数

在编组jaxb时从根元素中删除xmlns属性

这可能与JAXB Marshaller有关 - 如何抑制xmlns命名空间属性?

但我的问题有点不同.我做常规的java编组,我的xsd没有名称空间.生成的xml也没有名称空间,除了根元素.

<?xml version="1.0" encoding="UTF-8"?><rootElement xmlns:ns2="unwanted namespace">
Run Code Online (Sandbox Code Playgroud)

该unwanted namespace是从同一个项目另一个模式,我不知道这是为什么被拾起在这个阶段.

我的rootElement.java由jaxb2-maven-plugin生成,如下所示:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"feed"
})
@XmlRootElement(name = "rootElement", namespace = "")
public class RootElement{
....
}
Run Code Online (Sandbox Code Playgroud)

在这一点上,我想要的是xmlns:ns2="unwanted namespace"从生成的xml中删除属性,我正在努力解决它.

我查看了我的package-info.java,它看起来像:

@javax.xml.bind.annotation.XmlSchema(namespace = "unwanted namespace", elementFormDefault =   javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.mypackage;
Run Code Online (Sandbox Code Playgroud)

我尝试添加他,-npa但jaxb2-maven-plugin由于某种原因它不会工作.我尝试了NamespaceMapper但这适用于更改前缀.我无法完全删除名称空间.这让我困扰了一天.

java xml jaxb xml-namespaces jaxb2-maven-plugin

5
推荐指数
1
解决办法
6531
查看次数

为什么对于在模式中定义为"拥有"命名空间的xml元素,需要'null-namespace'?

以下xml文档和架构是从一个更大的架构中归结而来的,该架构首先出现问题:

xml文档:

<f2b:Foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:f2b="http://www.outerfoospace.com/schemas/foo2bar" xsi:schemaLocation="http://www.outerfoospace.com/schemas/foo2bar f2b-0-0-0.xsd">
    <f2b:Bar>text</f2b:Bar>
</f2b:Foo>
Run Code Online (Sandbox Code Playgroud)

架构:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f2b="http://www.outerfoospace.com/schemas/foo2bar" targetNamespace="http://www.outerfoospace.com/schemas/foo2bar">
    <xs:complexType name="T_Foo">
        <xs:sequence>
            <xs:element name="Bar" xmlns="f2b"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="Foo" type="f2b:T_Foo"/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)

当我根据模式验证文档时,我在<f2b:Bar>-element 上收到一条错误消息,说明这<f2b:Bar>是不期望的.为使文件有效我必须把<Bar>-元素明确进入"空命名空间"(!) <Bar xmlns="">.我不明白为什么应该期望null-namespaced元素.该架构定义的所有元素和对命名空间<Foo>-元素的f2b-命名确实是验证预期.但是,即使我明确设置命名空间中<Bar>-元素定义,就像我上面那样,验证仍预计xmlns=""为Bar -元素.我尝试了架构和文档的几种变体来找到一个没有运气的答案 - 我简直无法猜测为什么在这种特殊情况下会出现空命名空间.

任何暗示都赞赏... ekke

xml xsd xml-namespaces

5
推荐指数
1
解决办法
1904
查看次数

使用LINQ to XML更改命名空间值的最简单方法是什么?

TL/DR:更改命名空间值的最简单方法是什么?LINQ to XML比如说?xmlns:gcs="clr-namespace:NsOne;assembly=AsmOne"xmlns:gcs="clr-namespace:NsTwo;assembly=AsmTwo"

为什么?因为:

我Xaml使用了序列化System.Windows.Markup.XamlWriter.Save(myControl).我想System.Windows.Markup.XamlReader.Parse(raw)在另一个项目中将这个GUI外观可视化到其他地方(反序列化使用).

我不想链接到原始程序集!

我只需要更改命名空间,因此XamlReader.Parse(raw)不会抛出异常.我目前使用正则表达式来做它并且它可以工作,但我不喜欢那种方法(例如,如果我在xmlns:gcs="clr-namespace:NsOne;assembly=AsmOne"里面CDATA)

这是我的序列化Xaml:

<FlowDocument PagePadding="5,0,5,0" AllowDrop="True"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:gcs="clr-namespace:NsOne;assembly=AsmOne"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <gcs:MyParagraph Margin="0,0,0,0">
        <gcs:MyParagraph.MetaData>
            <gcs:ParagraphMetaData UpdaterParagraphUniqueId="1" />
        </gcs:MyParagraph.MetaData>
        <Span>some text...</Span>
    </gcs:MyParagraph>
    <gcs:MyParagraph Margin="0,0,0,0" Background="#FFF0F0F0">
        <gcs:MyParagraph.MetaData>
            <gcs:ParagraphMetaData UpdaterParagraphUniqueId="2" />
        </gcs:MyParagraph.MetaData>
        <Span Foreground="#FF0000FF">some more text...</Span>
    </gcs:MyParagraph>
</FlowDocument>
Run Code Online (Sandbox Code Playgroud)

(MyParagraph并且ParagraphMetaData是自定义类型,它们都存在于源程序集和目标程序MyParagraph集中.继承自WPF的Paragraph)

c# xml xaml serialization xml-namespaces

5
推荐指数
1
解决办法
1787
查看次数

HTML/HTML5的默认命名空间是什么?

根据这个名为"w3c"的用户的页面,HTML的默认命名空间是:

http://www.w3.org/1999/xhtml
Run Code Online (Sandbox Code Playgroud)

他显然是错的,因为xhtml被用于基于XML的HTML4标准失败.我应该使用什么是正确的命名空间?

背景:我正在编写一个使用XML的应用程序.我希望能够使用命名空间在XML节点上保存数据.例如,

<s:Button width="100" height="100" html:color="blue" color="black" /> 
Run Code Online (Sandbox Code Playgroud)

XML解析器需要"html"前缀的命名空间才有效.

html xml html5 xml-namespaces

5
推荐指数
2
解决办法
6348
查看次数

将JSF Composite Component打包到JAR中

当我们尝试将我们的复合组件捆绑到一个jar中并作为依赖项包含在另一个项目中时,我遵循了以下答案.

这适用于除复合组件实现之外的所有内容.我们常见项目的文件夹结构如下所示:

CommonWebProject
 |-- META-INF
 |    |-- resources
 |    |    `-- common
 |    |         |-- css
 |    |         |    ...
 |    |         |-- js
 |    |         |    ...
 |    |         |-- components
 |    |         |    `-- comment.xhtml
 |    |         |-- templates
 |    |         |    `-- defaultTemplate.xhtml
 |    |-- faces-config.xml
 |    `-- MANIFEST.MF
 :
Run Code Online (Sandbox Code Playgroud)

comment.xhtml包括:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:composite="http://java.sun.com/jsf/composite">

<composite:interface>

</composite:interface>

<composite:implementation>
  <p>TESTING!</p>
</composite:implementation>

</html> …
Run Code Online (Sandbox Code Playgroud)

jsf modularity xml-namespaces composite-component jsf-2

5
推荐指数
1
解决办法
422
查看次数