summaryrefslogtreecommitdiff
path: root/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java
diff options
context:
space:
mode:
Diffstat (limited to 'ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java')
-rw-r--r--ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java b/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java
new file mode 100644
index 000000000000..078c9e13de10
--- /dev/null
+++ b/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/XmlNamespace.java
@@ -0,0 +1,69 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*************************************************************/
+
+package org.apache.openoffice.ooxml.schema.parser;
+
+import org.apache.openoffice.ooxml.schema.model.attribute.Attribute;
+import org.apache.openoffice.ooxml.schema.model.base.Location;
+import org.apache.openoffice.ooxml.schema.model.base.QualifiedName;
+import org.apache.openoffice.ooxml.schema.model.schema.SchemaBase;
+import org.apache.openoffice.ooxml.schema.model.simple.Restriction;
+import org.apache.openoffice.ooxml.schema.model.simple.SimpleType;
+
+/** The http://www.w3.org/XML/1998/namespace namespace is
+ * implicitly included in all schema files.
+ *
+ * This class makes the necessary additions to namespace map and Schema object.
+ */
+public class XmlNamespace
+{
+ public static final String URI = "http://www.w3.org/XML/1998/namespace";
+ public static final String Prefix = "xml";
+
+ public static void Apply (final SchemaBase aSchemaBase)
+ {
+ aSchemaBase.Namespaces.ProvideNamespace(URI, Prefix);
+
+ final QualifiedName aStSpaceSimpleTypeName = new QualifiedName(URI, Prefix, "ST__space");
+ aSchemaBase.Attributes.Add(
+ new Attribute(
+ new QualifiedName(URI, Prefix, "space"),
+ aStSpaceSimpleTypeName,
+ "optional",
+ null,
+ null,
+ FormDefault.unqualified,
+ null));
+
+ final SimpleType aType = new SimpleType(
+ null,
+ aStSpaceSimpleTypeName,
+ new Location());
+ final Restriction aRestriction = new Restriction(
+ aType,
+ new QualifiedName(XsdNamespace.URI, XsdNamespace.Prefix, "token"),
+ null);
+ aRestriction.AddEnumeration("default");
+ aRestriction.AddEnumeration("preserve");
+ aType.AddChild(aRestriction);
+ aSchemaBase.SimpleTypes.Add(aType);
+ }
+}