jplaw

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 4 Imported by: 1

README

go-jplaw-xml

Go library for parsing Japanese Standard Law XML Schema (法令標準XMLスキーマ) documents.

This library provides comprehensive Go struct definitions that fully implement the Japanese Law XML Schema v3, enabling parsing and manipulation of Japanese legal documents in XML format.

Features

  • Complete XSD Implementation: Full coverage of the Japanese Law XML Schema v3
  • Type-Safe Parsing: Strongly-typed Go structs for all XML elements
  • Comprehensive Coverage: Supports all legal document structures including:
    • Law titles and metadata (Era, Year, Law numbers)
    • Table of Contents (TOC) with nested chapters and sections
    • Main provisions with articles, paragraphs, and items
    • Supplementary provisions and appendices
    • Complex nested structures (up to 10 levels of subitems)
    • Tables, figures, and formatting elements
    • Ruby text and multilingual support

Installation

go get go.ngs.io/jplaw-xml

Usage

Basic Parsing
package main

import (
	"encoding/xml"
	"io"
	"log"
	"os"

	"go.ngs.io/jplaw-xml"
)

func main() {
	file, err := os.Open("path/to/law.xml")
	if err != nil {
		log.Fatalf("Failed to open file: %v", err)
	}
	defer file.Close()

	data, err := io.ReadAll(file)
	if err != nil {
		log.Fatalf("Failed to read file: %v", err)
	}

	var law jplaw.Law
	err = xml.Unmarshal(data, &law)
	if err != nil {
		log.Fatalf("Failed to parse XML: %v", err)
	}

	// Access law metadata
	log.Println("Law Number:", law.LawNum)
	log.Println("Era:", law.Era)
	log.Println("Year:", law.Year)
	
	// Access law title
	if law.LawBody.LawTitle != nil {
		log.Println("Title:", law.LawBody.LawTitle.Content)
		log.Println("Kana:", law.LawBody.LawTitle.Kana)
	}

	// Iterate through table of contents
	if law.LawBody.TOC != nil {
		for _, chapter := range law.LawBody.TOC.TOCChapter {
			log.Printf("Chapter %s: %s", chapter.Num, chapter.ChapterTitle.Content)
		}
	}

	// Access main provisions
	for _, chapter := range law.LawBody.MainProvision.Chapter {
		log.Printf("Chapter: %s", chapter.ChapterTitle.Content)
		for _, article := range chapter.Article {
			if article.ArticleTitle != nil {
				log.Printf("  Article %s: %s", article.Num, article.ArticleTitle.Content)
			}
		}
	}
}
Creating XML Documents
law := jplaw.Law{
	Era:     jplaw.EraReiwa,
	Year:    5,
	Num:     "1",
	LawType: jplaw.LawTypeAct,
	Lang:    jplaw.LanguageJapanese,
	LawNum:  "令和五年法律第一号",
	LawBody: jplaw.LawBody{
		LawTitle: &jplaw.LawTitle{
			Content: "テスト法",
			Kana:    "てすとほう",
		},
		MainProvision: jplaw.MainProvision{
			Article: []jplaw.Article{
				{
					Num: "1",
					ArticleTitle: &jplaw.ArticleTitle{
						Content: "目的",
					},
					Paragraph: []jplaw.Paragraph{
						{
							Num: 1,
							ParagraphNum: jplaw.ParagraphNum{
								Content: "1",
							},
							ParagraphSentence: jplaw.ParagraphSentence{
								Sentence: []jplaw.Sentence{
									{
										Content: "この法律は、テストを目的とする。",
									},
								},
							},
						},
					},
				},
			},
		},
	},
}

// Marshal to XML
data, err := xml.MarshalIndent(law, "", "  ")
if err != nil {
	log.Fatal(err)
}
fmt.Println(string(data))

Supported Elements

The library supports all elements defined in the Japanese Law XML Schema including:

  • Law Structure: Law, LawBody, LawTitle
  • Table of Contents: TOC, TOCChapter, TOCSection, TOCSubsection
  • Provisions: MainProvision, SupplProvision, Article, Paragraph
  • Items: Item, Subitem1-10, List, Sublist1-3
  • Content: Sentence, Column, Ruby, Line
  • Tables: TableStruct, Table, TableRow, TableColumn
  • Figures: FigStruct, Fig, NoteStruct, StyleStruct
  • Appendices: AppdxTable, AppdxNote, AppdxStyle, AppdxFormat

Constants

The library provides typed constants for common values:

// Eras
jplaw.EraShowa
jplaw.EraHeisei  
jplaw.EraReiwa

// Law Types
jplaw.LawTypeAct
jplaw.LawTypeImperialOrdinance
jplaw.LawTypeCabinetOrder

// Languages
jplaw.LanguageJapanese
jplaw.LanguageEnglish

// Writing Modes
jplaw.WritingModeVertical
jplaw.WritingModeHorizontal

Testing

Run the test suite:

go test -v

The tests include comprehensive validation against real Japanese law XML documents.

Schema Compliance

This library implements the complete Japanese Standard Law XML Schema v3 as published by the Japanese government. It has been tested against real legal documents including the Aviation Law (航空法) and provides full coverage of all schema elements and attributes.

Author

Atsushi Nagase

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmendProvision

type AmendProvision struct {
	AmendProvisionSentence *AmendProvisionSentence `xml:"AmendProvisionSentence,omitempty"`
	NewProvision           []NewProvision          `xml:"NewProvision,omitempty"`
}

AmendProvision represents an amendment provision

type AmendProvisionSentence

type AmendProvisionSentence struct {
	Sentence Sentence `xml:"Sentence"`
}

AmendProvisionSentence represents an amendment provision sentence

type Appdx

type Appdx struct {
	ArithFormulaNum   *ArithFormulaNum   `xml:"ArithFormulaNum,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	ArithFormula      []ArithFormula     `xml:"ArithFormula"`
	Remarks           *Remarks           `xml:"Remarks,omitempty"`
}

Appdx represents an appendix

type AppdxFig

type AppdxFig struct {
	Num               int                `xml:"Num,attr,omitempty"`
	AppdxFigTitle     *AppdxFigTitle     `xml:"AppdxFigTitle,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	FigStruct         []FigStruct        `xml:"FigStruct,omitempty"`
	TableStruct       []TableStruct      `xml:"TableStruct,omitempty"`
}

AppdxFig represents an appendix figure

type AppdxFigTitle

type AppdxFigTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

AppdxFigTitle represents an appendix figure title

type AppdxFormat

type AppdxFormat struct {
	Num               int                `xml:"Num,attr,omitempty"`
	AppdxFormatTitle  *AppdxFormatTitle  `xml:"AppdxFormatTitle,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	FormatStruct      []FormatStruct     `xml:"FormatStruct,omitempty"`
	Remarks           *Remarks           `xml:"Remarks,omitempty"`
}

AppdxFormat represents an appendix format

type AppdxFormatTitle

type AppdxFormatTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

AppdxFormatTitle represents an appendix format title

type AppdxNote

type AppdxNote struct {
	Num               int                `xml:"Num,attr,omitempty"`
	AppdxNoteTitle    *AppdxNoteTitle    `xml:"AppdxNoteTitle,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	NoteStruct        []NoteStruct       `xml:"NoteStruct,omitempty"`
	FigStruct         []FigStruct        `xml:"FigStruct,omitempty"`
	TableStruct       []TableStruct      `xml:"TableStruct,omitempty"`
	Remarks           *Remarks           `xml:"Remarks,omitempty"`
}

AppdxNote represents an appendix note

type AppdxNoteTitle

type AppdxNoteTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

AppdxNoteTitle represents an appendix note title

type AppdxStyle

type AppdxStyle struct {
	Num               int                `xml:"Num,attr,omitempty"`
	AppdxStyleTitle   *AppdxStyleTitle   `xml:"AppdxStyleTitle,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	StyleStruct       []StyleStruct      `xml:"StyleStruct,omitempty"`
	Remarks           *Remarks           `xml:"Remarks,omitempty"`
}

AppdxStyle represents an appendix style

type AppdxStyleTitle

type AppdxStyleTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

AppdxStyleTitle represents an appendix style title

type AppdxTable

type AppdxTable struct {
	Num               int                `xml:"Num,attr,omitempty"`
	AppdxTableTitle   *AppdxTableTitle   `xml:"AppdxTableTitle,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	TableStruct       []TableStruct      `xml:"TableStruct,omitempty"`
	Item              []Item             `xml:"Item,omitempty"`
	Remarks           *Remarks           `xml:"Remarks,omitempty"`
}

AppdxTable represents an appendix table

type AppdxTableTitle

type AppdxTableTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

AppdxTableTitle represents an appendix table title

type ArithFormula

type ArithFormula struct {
	Num     int    `xml:"Num,attr,omitempty"`
	Content string `xml:",innerxml"`
}

ArithFormula represents an arithmetic formula

type ArithFormulaNum

type ArithFormulaNum struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ArithFormulaNum represents an arithmetic formula number

type Article

type Article struct {
	Num            string          `xml:"Num,attr"`
	Delete         bool            `xml:"Delete,attr,omitempty"`
	Hide           bool            `xml:"Hide,attr,omitempty"`
	ArticleCaption *ArticleCaption `xml:"ArticleCaption,omitempty"`
	ArticleTitle   *ArticleTitle   `xml:"ArticleTitle,omitempty"`
	Paragraph      []Paragraph     `xml:"Paragraph"`
	SupplNote      *SupplNote      `xml:"SupplNote,omitempty"`
}

Article represents an article

type ArticleCaption

type ArticleCaption struct {
	CommonCaption bool   `xml:"CommonCaption,attr,omitempty"`
	Content       string `xml:",chardata"`
	Line          []Line `xml:"Line,omitempty"`
	Ruby          []Ruby `xml:"Ruby,omitempty"`
	Sup           []Sup  `xml:"Sup,omitempty"`
	Sub           []Sub  `xml:"Sub,omitempty"`
}

ArticleCaption represents an article caption

type ArticleRange

type ArticleRange struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ArticleRange represents an article range

type ArticleTitle

type ArticleTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ArticleTitle represents an article title

type Chapter

type Chapter struct {
	Num          string       `xml:"Num,attr"`
	Delete       bool         `xml:"Delete,attr,omitempty"`
	Hide         bool         `xml:"Hide,attr,omitempty"`
	ChapterTitle ChapterTitle `xml:"ChapterTitle"`
	Article      []Article    `xml:"Article,omitempty"`
	Section      []Section    `xml:"Section,omitempty"`
}

Chapter represents a chapter

type ChapterTitle

type ChapterTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ChapterTitle represents a chapter title

type Class

type Class struct {
	Num           string        `xml:"Num,attr"`
	ClassTitle    *ClassTitle   `xml:"ClassTitle,omitempty"`
	ClassSentence ClassSentence `xml:"ClassSentence"`
	Item          []Item        `xml:"Item,omitempty"`
}

Class represents a class

type ClassSentence

type ClassSentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

ClassSentence represents a class sentence

type ClassTitle

type ClassTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ClassTitle represents a class title

type Column

type Column struct {
	Num       int        `xml:"Num,attr,omitempty"`
	LineBreak bool       `xml:"LineBreak,attr,omitempty"`
	Align     string     `xml:"Align,attr,omitempty"` // left, center, right, justify
	Sentence  []Sentence `xml:"Sentence"`
}

Column represents a column

type ContentNode added in v0.0.5

type ContentNode interface {
	String() string // Returns plain text representation
	HTML() string   // Returns HTML representation with Ruby tags
	IsRuby() bool   // Returns true if this is a Ruby node
}

ContentNode represents a node in mixed content (text or Ruby element)

type Division

type Division struct {
	Num           string        `xml:"Num,attr"`
	Delete        bool          `xml:"Delete,attr,omitempty"`
	Hide          bool          `xml:"Hide,attr,omitempty"`
	DivisionTitle DivisionTitle `xml:"DivisionTitle"`
	Article       []Article     `xml:"Article"`
}

Division represents a division

type DivisionTitle

type DivisionTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

DivisionTitle represents a division title

type EnactStatement

type EnactStatement struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

EnactStatement represents an enactment statement

type Era

type Era string
const (
	EraMeiji  Era = "Meiji"
	EraTaisho Era = "Taisho"
	EraShowa  Era = "Showa"
	EraHeisei Era = "Heisei"
	EraReiwa  Era = "Reiwa"
)

type Fig

type Fig struct {
	Src string `xml:"src,attr"`
}

Fig represents a figure

type FigStruct

type FigStruct struct {
	FigStructTitle *FigStructTitle `xml:"FigStructTitle,omitempty"`
	Fig            Fig             `xml:"Fig"`
	Remarks        []Remarks       `xml:"Remarks,omitempty"`
}

FigStruct represents a figure structure

type FigStructTitle

type FigStructTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

FigStructTitle represents a figure structure title

type Format

type Format struct {
	Content string `xml:",innerxml"`
}

Format represents a format

type FormatStruct

type FormatStruct struct {
	FormatStructTitle *FormatStructTitle `xml:"FormatStructTitle,omitempty"`
	Format            Format             `xml:"Format"`
	Remarks           []Remarks          `xml:"Remarks,omitempty"`
}

FormatStruct represents a format structure

type FormatStructTitle

type FormatStructTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

FormatStructTitle represents a format structure title

type Item

type Item struct {
	Num          string        `xml:"Num,attr"`
	Delete       bool          `xml:"Delete,attr,omitempty"`
	Hide         bool          `xml:"Hide,attr,omitempty"`
	ItemTitle    *ItemTitle    `xml:"ItemTitle,omitempty"`
	ItemSentence ItemSentence  `xml:"ItemSentence"`
	Subitem1     []Subitem1    `xml:"Subitem1,omitempty"`
	TableStruct  []TableStruct `xml:"TableStruct,omitempty"`
	FigStruct    []FigStruct   `xml:"FigStruct,omitempty"`
	StyleStruct  []StyleStruct `xml:"StyleStruct,omitempty"`
	List         []List        `xml:"List,omitempty"`
}

Item represents an item

type ItemSentence

type ItemSentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

ItemSentence represents an item sentence

type ItemTitle

type ItemTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ItemTitle represents an item title

type Language

type Language string
const (
	LanguageJapanese Language = "ja"
	LanguageEnglish  Language = "en"
)

type Law

type Law struct {
	XMLName         xml.Name `xml:"Law"`
	Era             Era      `xml:"Era,attr"`
	Year            int      `xml:"Year,attr"`
	Num             string   `xml:"Num,attr"`
	PromulgateMonth int      `xml:"PromulgateMonth,attr,omitempty"`
	PromulgateDay   int      `xml:"PromulgateDay,attr,omitempty"`
	LawType         LawType  `xml:"LawType,attr"`
	Lang            Language `xml:"Lang,attr"`
	LawNum          string   `xml:"LawNum"`
	LawBody         LawBody  `xml:"LawBody"`
}

Law represents the root element of a Japanese law document

type LawBody

type LawBody struct {
	Subject        string           `xml:"Subject,attr,omitempty"`
	LawTitle       *LawTitle        `xml:"LawTitle,omitempty"`
	EnactStatement []EnactStatement `xml:"EnactStatement,omitempty"`
	TOC            *TOC             `xml:"TOC,omitempty"`
	Preamble       *Preamble        `xml:"Preamble,omitempty"`
	MainProvision  MainProvision    `xml:"MainProvision"`
	SupplProvision []SupplProvision `xml:"SupplProvision,omitempty"`
	AppdxTable     []AppdxTable     `xml:"AppdxTable,omitempty"`
	AppdxNote      []AppdxNote      `xml:"AppdxNote,omitempty"`
	AppdxStyle     []AppdxStyle     `xml:"AppdxStyle,omitempty"`
	Appdx          []Appdx          `xml:"Appdx,omitempty"`
	AppdxFig       []AppdxFig       `xml:"AppdxFig,omitempty"`
	AppdxFormat    []AppdxFormat    `xml:"AppdxFormat,omitempty"`
}

LawBody represents the body of a law document

type LawTitle

type LawTitle struct {
	Kana       string `xml:"Kana,attr,omitempty"`
	Abbrev     string `xml:"Abbrev,attr,omitempty"`
	AbbrevKana string `xml:"AbbrevKana,attr,omitempty"`
	Content    string `xml:",chardata"`
	Line       []Line `xml:"Line,omitempty"`
	Ruby       []Ruby `xml:"Ruby,omitempty"`
	Sup        []Sup  `xml:"Sup,omitempty"`
	Sub        []Sub  `xml:"Sub,omitempty"`
}

LawTitle represents the title of a law

type LawType

type LawType string
const (
	LawTypeConstitution         LawType = "Constitution"
	LawTypeAct                  LawType = "Act"
	LawTypeCabinetOrder         LawType = "CabinetOrder"
	LawTypeImperialOrder        LawType = "ImperialOrder"
	LawTypeMinisterialOrdinance LawType = "MinisterialOrdinance"
	LawTypeRule                 LawType = "Rule"
	LawTypeMisc                 LawType = "Misc"
)

type Line

type Line struct {
	Style        string         `xml:"Style,attr,omitempty"` // dotted, double, none, solid
	Content      string         `xml:",chardata"`
	QuoteStruct  []QuoteStruct  `xml:"QuoteStruct,omitempty"`
	ArithFormula []ArithFormula `xml:"ArithFormula,omitempty"`
	Ruby         []Ruby         `xml:"Ruby,omitempty"`
	Sup          []Sup          `xml:"Sup,omitempty"`
	Sub          []Sub          `xml:"Sub,omitempty"`
}

Line represents a line

type List

type List struct {
	ListSentence ListSentence `xml:"ListSentence"`
	Sublist1     []Sublist1   `xml:"Sublist1,omitempty"`
}

List represents a list

type ListSentence

type ListSentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
}

ListSentence represents a list sentence

type MainProvision

type MainProvision struct {
	Extract   bool        `xml:"Extract,attr,omitempty"`
	Part      []Part      `xml:"Part,omitempty"`
	Chapter   []Chapter   `xml:"Chapter,omitempty"`
	Section   []Section   `xml:"Section,omitempty"`
	Article   []Article   `xml:"Article,omitempty"`
	Paragraph []Paragraph `xml:"Paragraph,omitempty"`
}

MainProvision represents the main provision

type MixedContent added in v0.0.5

type MixedContent struct {
	Nodes []ContentNode
}

MixedContent holds ordered content nodes (text and Ruby elements)

func (MixedContent) HTML added in v0.0.5

func (m MixedContent) HTML() string

HTML returns the HTML representation with Ruby tags

func (MixedContent) String added in v0.0.5

func (m MixedContent) String() string

String returns the plain text representation of all nodes

func (*MixedContent) UnmarshalXML added in v0.0.5

func (m *MixedContent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling to preserve mixed content order

type NewProvision

type NewProvision struct {
	Content                  string                     `xml:",innerxml"`
	LawTitle                 *LawTitle                  `xml:"LawTitle,omitempty"`
	Preamble                 *Preamble                  `xml:"Preamble,omitempty"`
	TOC                      *TOC                       `xml:"TOC,omitempty"`
	Part                     []Part                     `xml:"Part,omitempty"`
	PartTitle                []PartTitle                `xml:"PartTitle,omitempty"`
	Chapter                  []Chapter                  `xml:"Chapter,omitempty"`
	ChapterTitle             []ChapterTitle             `xml:"ChapterTitle,omitempty"`
	Section                  []Section                  `xml:"Section,omitempty"`
	SectionTitle             []SectionTitle             `xml:"SectionTitle,omitempty"`
	Subsection               []Subsection               `xml:"Subsection,omitempty"`
	SubsectionTitle          []SubsectionTitle          `xml:"SubsectionTitle,omitempty"`
	Division                 []Division                 `xml:"Division,omitempty"`
	DivisionTitle            []DivisionTitle            `xml:"DivisionTitle,omitempty"`
	Article                  []Article                  `xml:"Article,omitempty"`
	SupplNote                []SupplNote                `xml:"SupplNote,omitempty"`
	Paragraph                []Paragraph                `xml:"Paragraph,omitempty"`
	Item                     []Item                     `xml:"Item,omitempty"`
	Subitem1                 []Subitem1                 `xml:"Subitem1,omitempty"`
	Subitem2                 []Subitem2                 `xml:"Subitem2,omitempty"`
	Subitem3                 []Subitem3                 `xml:"Subitem3,omitempty"`
	Subitem4                 []Subitem4                 `xml:"Subitem4,omitempty"`
	Subitem5                 []Subitem5                 `xml:"Subitem5,omitempty"`
	Subitem6                 []Subitem6                 `xml:"Subitem6,omitempty"`
	Subitem7                 []Subitem7                 `xml:"Subitem7,omitempty"`
	Subitem8                 []Subitem8                 `xml:"Subitem8,omitempty"`
	Subitem9                 []Subitem9                 `xml:"Subitem9,omitempty"`
	Subitem10                []Subitem10                `xml:"Subitem10,omitempty"`
	List                     []List                     `xml:"List,omitempty"`
	Sentence                 []Sentence                 `xml:"Sentence,omitempty"`
	AmendProvision           []AmendProvision           `xml:"AmendProvision,omitempty"`
	AppdxTable               []AppdxTable               `xml:"AppdxTable,omitempty"`
	AppdxNote                []AppdxNote                `xml:"AppdxNote,omitempty"`
	AppdxStyle               []AppdxStyle               `xml:"AppdxStyle,omitempty"`
	Appdx                    []Appdx                    `xml:"Appdx,omitempty"`
	AppdxFig                 []AppdxFig                 `xml:"AppdxFig,omitempty"`
	AppdxFormat              []AppdxFormat              `xml:"AppdxFormat,omitempty"`
	SupplProvisionAppdxStyle []SupplProvisionAppdxStyle `xml:"SupplProvisionAppdxStyle,omitempty"`
	SupplProvisionAppdxTable []SupplProvisionAppdxTable `xml:"SupplProvisionAppdxTable,omitempty"`
	SupplProvisionAppdx      []SupplProvisionAppdx      `xml:"SupplProvisionAppdx,omitempty"`
	TableStruct              *TableStruct               `xml:"TableStruct,omitempty"`
	TableRow                 []TableRow                 `xml:"TableRow,omitempty"`
	TableColumn              []TableColumn              `xml:"TableColumn,omitempty"`
	FigStruct                *FigStruct                 `xml:"FigStruct,omitempty"`
	NoteStruct               *NoteStruct                `xml:"NoteStruct,omitempty"`
	StyleStruct              *StyleStruct               `xml:"StyleStruct,omitempty"`
	FormatStruct             *FormatStruct              `xml:"FormatStruct,omitempty"`
	Remarks                  *Remarks                   `xml:"Remarks,omitempty"`
	LawBody                  *LawBody                   `xml:"LawBody,omitempty"`
}

NewProvision represents a new provision

type Note

type Note struct {
	Content string `xml:",innerxml"`
}

Note represents a note

type NoteStruct

type NoteStruct struct {
	NoteStructTitle *NoteStructTitle `xml:"NoteStructTitle,omitempty"`
	Note            Note             `xml:"Note"`
	Remarks         []Remarks        `xml:"Remarks,omitempty"`
}

NoteStruct represents a note structure

type NoteStructTitle

type NoteStructTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

NoteStructTitle represents a note structure title

type Paragraph

type Paragraph struct {
	Num               int               `xml:"Num,attr"`
	OldStyle          bool              `xml:"OldStyle,attr,omitempty"`
	OldNum            bool              `xml:"OldNum,attr,omitempty"`
	Hide              bool              `xml:"Hide,attr,omitempty"`
	ParagraphCaption  *ParagraphCaption `xml:"ParagraphCaption,omitempty"`
	ParagraphNum      ParagraphNum      `xml:"ParagraphNum"`
	ParagraphSentence ParagraphSentence `xml:"ParagraphSentence"`
	AmendProvision    []AmendProvision  `xml:"AmendProvision,omitempty"`
	Class             []Class           `xml:"Class,omitempty"`
	TableStruct       []TableStruct     `xml:"TableStruct,omitempty"`
	FigStruct         []FigStruct       `xml:"FigStruct,omitempty"`
	StyleStruct       []StyleStruct     `xml:"StyleStruct,omitempty"`
	Item              []Item            `xml:"Item,omitempty"`
	List              []List            `xml:"List,omitempty"`
}

Paragraph represents a paragraph

type ParagraphCaption

type ParagraphCaption struct {
	CommonCaption bool   `xml:"CommonCaption,attr,omitempty"`
	Content       string `xml:",chardata"`
	Line          []Line `xml:"Line,omitempty"`
	Ruby          []Ruby `xml:"Ruby,omitempty"`
	Sup           []Sup  `xml:"Sup,omitempty"`
	Sub           []Sub  `xml:"Sub,omitempty"`
}

ParagraphCaption represents a paragraph caption

type ParagraphNum

type ParagraphNum struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

ParagraphNum represents a paragraph number

type ParagraphSentence

type ParagraphSentence struct {
	Sentence []Sentence `xml:"Sentence"`
}

ParagraphSentence represents paragraph sentences

type Part

type Part struct {
	Num       string    `xml:"Num,attr"`
	Delete    bool      `xml:"Delete,attr,omitempty"`
	Hide      bool      `xml:"Hide,attr,omitempty"`
	PartTitle PartTitle `xml:"PartTitle"`
	Article   []Article `xml:"Article,omitempty"`
	Chapter   []Chapter `xml:"Chapter,omitempty"`
}

Part represents a part in the law structure

type PartTitle

type PartTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

PartTitle represents a part title

type Preamble

type Preamble struct {
	Paragraph []Paragraph `xml:"Paragraph"`
}

Preamble represents the preamble section

type QuoteStruct

type QuoteStruct struct {
	Content string `xml:",innerxml"`
}

QuoteStruct represents a quote structure

type RelatedArticleNum

type RelatedArticleNum struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

RelatedArticleNum represents a related article number

type Remarks

type Remarks struct {
	RemarksLabel RemarksLabel `xml:"RemarksLabel"`
	Item         []Item       `xml:"Item,omitempty"`
	Sentence     []Sentence   `xml:"Sentence,omitempty"`
}

Remarks represents remarks

type RemarksLabel

type RemarksLabel struct {
	LineBreak bool   `xml:"LineBreak,attr,omitempty"`
	Content   string `xml:",chardata"`
	Line      []Line `xml:"Line,omitempty"`
	Ruby      []Ruby `xml:"Ruby,omitempty"`
	Sup       []Sup  `xml:"Sup,omitempty"`
	Sub       []Sub  `xml:"Sub,omitempty"`
}

RemarksLabel represents a remarks label

type Rt

type Rt struct {
	Content string `xml:",chardata"`
}

Rt represents ruby text content

type Ruby

type Ruby struct {
	Content string `xml:",chardata"`
	Rt      []Rt   `xml:"Rt,omitempty"`
}

Ruby represents ruby text (phonetic guides)

type RubyNode added in v0.0.5

type RubyNode struct {
	Base string   // The base text (e.g., "較")
	Rt   []string // The ruby text annotations (e.g., ["こう"])
}

RubyNode represents a Ruby annotation in mixed content

func (RubyNode) HTML added in v0.0.5

func (r RubyNode) HTML() string

HTML returns HTML ruby markup

func (RubyNode) IsRuby added in v0.0.5

func (r RubyNode) IsRuby() bool

IsRuby returns true for Ruby nodes

func (RubyNode) String added in v0.0.5

func (r RubyNode) String() string

String returns the base text only

type Section

type Section struct {
	Num          string       `xml:"Num,attr"`
	Delete       bool         `xml:"Delete,attr,omitempty"`
	Hide         bool         `xml:"Hide,attr,omitempty"`
	SectionTitle SectionTitle `xml:"SectionTitle"`
	Article      []Article    `xml:"Article,omitempty"`
	Subsection   []Subsection `xml:"Subsection,omitempty"`
	Division     []Division   `xml:"Division,omitempty"`
}

Section represents a section

type SectionTitle

type SectionTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

SectionTitle represents a section title

type Sentence

type Sentence struct {
	Num          int            `xml:"Num,attr,omitempty"`
	Function     string         `xml:"Function,attr,omitempty"` // main or proviso
	Indent       string         `xml:"Indent,attr,omitempty"`
	WritingMode  WritingMode    `xml:"WritingMode,attr,omitempty"`
	Content      string         // Plain text content (backward compatibility)
	Line         []Line         `xml:"Line,omitempty"`
	QuoteStruct  []QuoteStruct  `xml:"QuoteStruct,omitempty"`
	ArithFormula []ArithFormula `xml:"ArithFormula,omitempty"`
	Ruby         []Ruby         // Ruby elements (backward compatibility)
	Sup          []Sup          `xml:"Sup,omitempty"`
	Sub          []Sub          `xml:"Sub,omitempty"`
	MixedContent MixedContent   // The properly ordered mixed content
}

Sentence represents a sentence NOTE: This type now uses custom XML unmarshaling to properly handle mixed content with inline Ruby elements

func (*Sentence) HTML added in v0.0.5

func (s *Sentence) HTML() string

HTML returns the HTML representation with properly positioned Ruby tags

func (*Sentence) UnmarshalXML added in v0.0.5

func (s *Sentence) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom unmarshaling to handle mixed content

type SentenceImproved added in v0.0.5

type SentenceImproved struct {
	Num          int            `xml:"Num,attr,omitempty"`
	Function     string         `xml:"Function,attr,omitempty"` // main or proviso
	Indent       string         `xml:"Indent,attr,omitempty"`
	WritingMode  WritingMode    `xml:"WritingMode,attr,omitempty"`
	Content      string         // Plain text content for backward compatibility
	Line         []Line         `xml:"Line,omitempty"`
	QuoteStruct  []QuoteStruct  `xml:"QuoteStruct,omitempty"`
	ArithFormula []ArithFormula `xml:"ArithFormula,omitempty"`
	Ruby         []Ruby         // Ruby elements for backward compatibility
	Sup          []Sup          `xml:"Sup,omitempty"`
	Sub          []Sub          `xml:"Sub,omitempty"`
	MixedContent MixedContent   // The properly parsed mixed content
}

SentenceImproved is an improved version of Sentence that handles mixed content properly while maintaining backward compatibility

func (*SentenceImproved) GetContent added in v0.0.5

func (s *SentenceImproved) GetContent() string

GetContent returns the plain text content (for backward compatibility)

func (*SentenceImproved) GetRubyHTML added in v0.0.5

func (s *SentenceImproved) GetRubyHTML() string

GetRubyHTML returns HTML with Ruby annotations

func (*SentenceImproved) HTML added in v0.0.5

func (s *SentenceImproved) HTML() string

HTML returns the HTML representation with Ruby tags

func (*SentenceImproved) String added in v0.0.5

func (s *SentenceImproved) String() string

String returns the plain text content

func (*SentenceImproved) UnmarshalXML added in v0.0.5

func (s *SentenceImproved) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom unmarshaling to handle mixed content while maintaining backward compatibility

type SentenceV2 added in v0.0.5

type SentenceV2 struct {
	Num          int          `xml:"Num,attr,omitempty"`
	Function     string       `xml:"Function,attr,omitempty"`
	Indent       string       `xml:"Indent,attr,omitempty"`
	WritingMode  WritingMode  `xml:"WritingMode,attr,omitempty"`
	MixedContent MixedContent // Custom unmarshaling for mixed content
}

SentenceV2 is an improved version of Sentence that properly handles mixed content

func (*SentenceV2) HTML added in v0.0.5

func (s *SentenceV2) HTML() string

HTML returns the HTML representation with Ruby tags

func (*SentenceV2) String added in v0.0.5

func (s *SentenceV2) String() string

String returns the plain text content

func (*SentenceV2) UnmarshalXML added in v0.0.5

func (s *SentenceV2) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom unmarshaling for SentenceV2

type Style

type Style struct {
	Content string `xml:",innerxml"`
}

Style represents a style

type StyleStruct

type StyleStruct struct {
	StyleStructTitle *StyleStructTitle `xml:"StyleStructTitle,omitempty"`
	Style            Style             `xml:"Style"`
	Remarks          []Remarks         `xml:"Remarks,omitempty"`
}

StyleStruct represents a style structure

type StyleStructTitle

type StyleStructTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

StyleStructTitle represents a style structure title

type Sub

type Sub struct {
	Content string `xml:",chardata"`
}

Sub represents subscript text

type Subitem1

type Subitem1 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem1Title    *Subitem1Title   `xml:"Subitem1Title,omitempty"`
	Subitem1Sentence Subitem1Sentence `xml:"Subitem1Sentence"`
	Subitem2         []Subitem2       `xml:"Subitem2,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

Subitem1 through Subitem10 represent nested subitems

type Subitem10

type Subitem10 struct {
	Num               string            `xml:"Num,attr"`
	Delete            bool              `xml:"Delete,attr,omitempty"`
	Hide              bool              `xml:"Hide,attr,omitempty"`
	Subitem10Title    *Subitem10Title   `xml:"Subitem10Title,omitempty"`
	Subitem10Sentence Subitem10Sentence `xml:"Subitem10Sentence"`
	TableStruct       []TableStruct     `xml:"TableStruct,omitempty"`
	FigStruct         []FigStruct       `xml:"FigStruct,omitempty"`
	StyleStruct       []StyleStruct     `xml:"StyleStruct,omitempty"`
	List              []List            `xml:"List,omitempty"`
}

type Subitem10Sentence

type Subitem10Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem10Title

type Subitem10Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem1Sentence

type Subitem1Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem1Title

type Subitem1Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem2

type Subitem2 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem2Title    *Subitem2Title   `xml:"Subitem2Title,omitempty"`
	Subitem2Sentence Subitem2Sentence `xml:"Subitem2Sentence"`
	Subitem3         []Subitem3       `xml:"Subitem3,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem2Sentence

type Subitem2Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem2Title

type Subitem2Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem3

type Subitem3 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem3Title    *Subitem3Title   `xml:"Subitem3Title,omitempty"`
	Subitem3Sentence Subitem3Sentence `xml:"Subitem3Sentence"`
	Subitem4         []Subitem4       `xml:"Subitem4,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem3Sentence

type Subitem3Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem3Title

type Subitem3Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem4

type Subitem4 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem4Title    *Subitem4Title   `xml:"Subitem4Title,omitempty"`
	Subitem4Sentence Subitem4Sentence `xml:"Subitem4Sentence"`
	Subitem5         []Subitem5       `xml:"Subitem5,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem4Sentence

type Subitem4Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem4Title

type Subitem4Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem5

type Subitem5 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem5Title    *Subitem5Title   `xml:"Subitem5Title,omitempty"`
	Subitem5Sentence Subitem5Sentence `xml:"Subitem5Sentence"`
	Subitem6         []Subitem6       `xml:"Subitem6,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem5Sentence

type Subitem5Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem5Title

type Subitem5Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem6

type Subitem6 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem6Title    *Subitem6Title   `xml:"Subitem6Title,omitempty"`
	Subitem6Sentence Subitem6Sentence `xml:"Subitem6Sentence"`
	Subitem7         []Subitem7       `xml:"Subitem7,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem6Sentence

type Subitem6Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem6Title

type Subitem6Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem7

type Subitem7 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem7Title    *Subitem7Title   `xml:"Subitem7Title,omitempty"`
	Subitem7Sentence Subitem7Sentence `xml:"Subitem7Sentence"`
	Subitem8         []Subitem8       `xml:"Subitem8,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem7Sentence

type Subitem7Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem7Title

type Subitem7Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem8

type Subitem8 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem8Title    *Subitem8Title   `xml:"Subitem8Title,omitempty"`
	Subitem8Sentence Subitem8Sentence `xml:"Subitem8Sentence"`
	Subitem9         []Subitem9       `xml:"Subitem9,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem8Sentence

type Subitem8Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem8Title

type Subitem8Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Subitem9

type Subitem9 struct {
	Num              string           `xml:"Num,attr"`
	Delete           bool             `xml:"Delete,attr,omitempty"`
	Hide             bool             `xml:"Hide,attr,omitempty"`
	Subitem9Title    *Subitem9Title   `xml:"Subitem9Title,omitempty"`
	Subitem9Sentence Subitem9Sentence `xml:"Subitem9Sentence"`
	Subitem10        []Subitem10      `xml:"Subitem10,omitempty"`
	TableStruct      []TableStruct    `xml:"TableStruct,omitempty"`
	FigStruct        []FigStruct      `xml:"FigStruct,omitempty"`
	StyleStruct      []StyleStruct    `xml:"StyleStruct,omitempty"`
	List             []List           `xml:"List,omitempty"`
}

type Subitem9Sentence

type Subitem9Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
	Table    *Table     `xml:"Table,omitempty"`
}

type Subitem9Title

type Subitem9Title struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

type Sublist1

type Sublist1 struct {
	Sublist1Sentence Sublist1Sentence `xml:"Sublist1Sentence"`
	Sublist2         []Sublist2       `xml:"Sublist2,omitempty"`
}

Sublist1 represents a first-level sublist

type Sublist1Sentence

type Sublist1Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
}

Sublist1Sentence represents a first-level sublist sentence

type Sublist2

type Sublist2 struct {
	Sublist2Sentence Sublist2Sentence `xml:"Sublist2Sentence"`
	Sublist3         []Sublist3       `xml:"Sublist3,omitempty"`
}

Sublist2 represents a second-level sublist

type Sublist2Sentence

type Sublist2Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
}

Sublist2Sentence represents a second-level sublist sentence

type Sublist3

type Sublist3 struct {
	Sublist3Sentence Sublist3Sentence `xml:"Sublist3Sentence"`
}

Sublist3 represents a third-level sublist

type Sublist3Sentence

type Sublist3Sentence struct {
	Sentence []Sentence `xml:"Sentence,omitempty"`
	Column   []Column   `xml:"Column,omitempty"`
}

Sublist3Sentence represents a third-level sublist sentence

type Subsection

type Subsection struct {
	Num             string          `xml:"Num,attr"`
	Delete          bool            `xml:"Delete,attr,omitempty"`
	Hide            bool            `xml:"Hide,attr,omitempty"`
	SubsectionTitle SubsectionTitle `xml:"SubsectionTitle"`
	Article         []Article       `xml:"Article,omitempty"`
	Division        []Division      `xml:"Division,omitempty"`
}

Subsection represents a subsection

type SubsectionTitle

type SubsectionTitle struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

SubsectionTitle represents a subsection title

type Sup

type Sup struct {
	Content string `xml:",chardata"`
}

Sup represents superscript text

type SupplNote

type SupplNote struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

SupplNote represents a supplementary note

type SupplProvision

type SupplProvision struct {
	Type                     string                     `xml:"Type,attr,omitempty"` // New or Amend
	AmendLawNum              string                     `xml:"AmendLawNum,attr,omitempty"`
	Extract                  bool                       `xml:"Extract,attr,omitempty"`
	SupplProvisionLabel      SupplProvisionLabel        `xml:"SupplProvisionLabel"`
	Chapter                  []Chapter                  `xml:"Chapter,omitempty"`
	Article                  []Article                  `xml:"Article,omitempty"`
	Paragraph                []Paragraph                `xml:"Paragraph,omitempty"`
	SupplProvisionAppdxTable []SupplProvisionAppdxTable `xml:"SupplProvisionAppdxTable,omitempty"`
	SupplProvisionAppdxStyle []SupplProvisionAppdxStyle `xml:"SupplProvisionAppdxStyle,omitempty"`
	SupplProvisionAppdx      []SupplProvisionAppdx      `xml:"SupplProvisionAppdx,omitempty"`
}

SupplProvision represents supplementary provisions

type SupplProvisionAppdx

type SupplProvisionAppdx struct {
	Num               int                `xml:"Num,attr,omitempty"`
	ArithFormulaNum   *ArithFormulaNum   `xml:"ArithFormulaNum,omitempty"`
	RelatedArticleNum *RelatedArticleNum `xml:"RelatedArticleNum,omitempty"`
	ArithFormula      []ArithFormula     `xml:"ArithFormula"`
}

SupplProvisionAppdx represents supplementary provision appendix

type SupplProvisionAppdxStyle

type SupplProvisionAppdxStyle struct {
	Num                           int                           `xml:"Num,attr,omitempty"`
	SupplProvisionAppdxStyleTitle SupplProvisionAppdxStyleTitle `xml:"SupplProvisionAppdxStyleTitle"`
	RelatedArticleNum             *RelatedArticleNum            `xml:"RelatedArticleNum,omitempty"`
	StyleStruct                   []StyleStruct                 `xml:"StyleStruct,omitempty"`
}

SupplProvisionAppdxStyle represents supplementary provision appendix style

type SupplProvisionAppdxStyleTitle

type SupplProvisionAppdxStyleTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

SupplProvisionAppdxStyleTitle represents title for supplementary provision appendix style

type SupplProvisionAppdxTable

type SupplProvisionAppdxTable struct {
	Num                           int                           `xml:"Num,attr,omitempty"`
	SupplProvisionAppdxTableTitle SupplProvisionAppdxTableTitle `xml:"SupplProvisionAppdxTableTitle"`
	RelatedArticleNum             *RelatedArticleNum            `xml:"RelatedArticleNum,omitempty"`
	TableStruct                   []TableStruct                 `xml:"TableStruct,omitempty"`
}

SupplProvisionAppdxTable represents supplementary provision appendix table

type SupplProvisionAppdxTableTitle

type SupplProvisionAppdxTableTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

SupplProvisionAppdxTableTitle represents title for supplementary provision appendix table

type SupplProvisionLabel

type SupplProvisionLabel struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

SupplProvisionLabel represents a supplementary provision label

type TOC

type TOC struct {
	TOCLabel           *TOCLabel            `xml:"TOCLabel,omitempty"`
	TOCPreambleLabel   *TOCPreambleLabel    `xml:"TOCPreambleLabel,omitempty"`
	TOCPart            []TOCPart            `xml:"TOCPart,omitempty"`
	TOCChapter         []TOCChapter         `xml:"TOCChapter,omitempty"`
	TOCSection         []TOCSection         `xml:"TOCSection,omitempty"`
	TOCArticle         []TOCArticle         `xml:"TOCArticle,omitempty"`
	TOCSupplProvision  *TOCSupplProvision   `xml:"TOCSupplProvision,omitempty"`
	TOCAppdxTableLabel []TOCAppdxTableLabel `xml:"TOCAppdxTableLabel,omitempty"`
}

TOC represents the table of contents

type TOCAppdxTableLabel

type TOCAppdxTableLabel struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

TOCAppdxTableLabel represents an appendix table label in TOC

type TOCArticle

type TOCArticle struct {
	Num            string         `xml:"Num,attr"`
	Delete         bool           `xml:"Delete,attr,omitempty"`
	ArticleTitle   ArticleTitle   `xml:"ArticleTitle"`
	ArticleCaption ArticleCaption `xml:"ArticleCaption"`
}

TOCArticle represents an article in the table of contents

type TOCChapter

type TOCChapter struct {
	Num          string        `xml:"Num,attr"`
	Delete       bool          `xml:"Delete,attr,omitempty"`
	ChapterTitle ChapterTitle  `xml:"ChapterTitle"`
	ArticleRange *ArticleRange `xml:"ArticleRange,omitempty"`
	TOCSection   []TOCSection  `xml:"TOCSection,omitempty"`
}

TOCChapter represents a chapter in the table of contents

type TOCDivision

type TOCDivision struct {
	Num           string        `xml:"Num,attr"`
	Delete        bool          `xml:"Delete,attr,omitempty"`
	DivisionTitle DivisionTitle `xml:"DivisionTitle"`
	ArticleRange  *ArticleRange `xml:"ArticleRange,omitempty"`
}

TOCDivision represents a division in the table of contents

type TOCLabel

type TOCLabel struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

TOCLabel represents a TOC label

type TOCPart

type TOCPart struct {
	Num          string        `xml:"Num,attr"`
	Delete       bool          `xml:"Delete,attr,omitempty"`
	PartTitle    PartTitle     `xml:"PartTitle"`
	ArticleRange *ArticleRange `xml:"ArticleRange,omitempty"`
	TOCChapter   []TOCChapter  `xml:"TOCChapter,omitempty"`
}

TOCPart represents a part in the table of contents

type TOCPreambleLabel

type TOCPreambleLabel struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

TOCPreambleLabel represents a TOC preamble label

type TOCSection

type TOCSection struct {
	Num           string          `xml:"Num,attr"`
	Delete        bool            `xml:"Delete,attr,omitempty"`
	SectionTitle  SectionTitle    `xml:"SectionTitle"`
	ArticleRange  *ArticleRange   `xml:"ArticleRange,omitempty"`
	TOCSubsection []TOCSubsection `xml:"TOCSubsection,omitempty"`
	TOCDivision   []TOCDivision   `xml:"TOCDivision,omitempty"`
}

TOCSection represents a section in the table of contents

type TOCSubsection

type TOCSubsection struct {
	Num             string          `xml:"Num,attr"`
	Delete          bool            `xml:"Delete,attr,omitempty"`
	SubsectionTitle SubsectionTitle `xml:"SubsectionTitle"`
	ArticleRange    *ArticleRange   `xml:"ArticleRange,omitempty"`
	TOCDivision     []TOCDivision   `xml:"TOCDivision,omitempty"`
}

TOCSubsection represents a subsection in the table of contents

type TOCSupplProvision

type TOCSupplProvision struct {
	SupplProvisionLabel SupplProvisionLabel `xml:"SupplProvisionLabel"`
	ArticleRange        *ArticleRange       `xml:"ArticleRange,omitempty"`
	TOCArticle          []TOCArticle        `xml:"TOCArticle,omitempty"`
	TOCChapter          []TOCChapter        `xml:"TOCChapter,omitempty"`
}

TOCSupplProvision represents supplementary provisions in TOC

type Table

type Table struct {
	WritingMode    WritingMode      `xml:"WritingMode,attr,omitempty"`
	TableHeaderRow []TableHeaderRow `xml:"TableHeaderRow,omitempty"`
	TableRow       []TableRow       `xml:"TableRow"`
}

Table represents a table

type TableColumn

type TableColumn struct {
	BorderTop    string       `xml:"BorderTop,attr,omitempty"`    // solid, none, dotted, double
	BorderBottom string       `xml:"BorderBottom,attr,omitempty"` // solid, none, dotted, double
	BorderLeft   string       `xml:"BorderLeft,attr,omitempty"`   // solid, none, dotted, double
	BorderRight  string       `xml:"BorderRight,attr,omitempty"`  // solid, none, dotted, double
	Rowspan      string       `xml:"rowspan,attr,omitempty"`
	Colspan      string       `xml:"colspan,attr,omitempty"`
	Align        string       `xml:"Align,attr,omitempty"`  // left, center, right, justify
	Valign       string       `xml:"Valign,attr,omitempty"` // top, middle, bottom
	Part         []Part       `xml:"Part,omitempty"`
	Chapter      []Chapter    `xml:"Chapter,omitempty"`
	Section      []Section    `xml:"Section,omitempty"`
	Subsection   []Subsection `xml:"Subsection,omitempty"`
	Division     []Division   `xml:"Division,omitempty"`
	Article      []Article    `xml:"Article,omitempty"`
	Paragraph    []Paragraph  `xml:"Paragraph,omitempty"`
	Item         []Item       `xml:"Item,omitempty"`
	Subitem1     []Subitem1   `xml:"Subitem1,omitempty"`
	Subitem2     []Subitem2   `xml:"Subitem2,omitempty"`
	Subitem3     []Subitem3   `xml:"Subitem3,omitempty"`
	Subitem4     []Subitem4   `xml:"Subitem4,omitempty"`
	Subitem5     []Subitem5   `xml:"Subitem5,omitempty"`
	Subitem6     []Subitem6   `xml:"Subitem6,omitempty"`
	Subitem7     []Subitem7   `xml:"Subitem7,omitempty"`
	Subitem8     []Subitem8   `xml:"Subitem8,omitempty"`
	Subitem9     []Subitem9   `xml:"Subitem9,omitempty"`
	Subitem10    []Subitem10  `xml:"Subitem10,omitempty"`
	FigStruct    []FigStruct  `xml:"FigStruct,omitempty"`
	Remarks      *Remarks     `xml:"Remarks,omitempty"`
	Sentence     []Sentence   `xml:"Sentence,omitempty"`
	Column       []Column     `xml:"Column,omitempty"`
}

TableColumn represents a table column

type TableHeaderColumn

type TableHeaderColumn struct {
	Content string `xml:",chardata"`
	Line    []Line `xml:"Line,omitempty"`
	Ruby    []Ruby `xml:"Ruby,omitempty"`
	Sup     []Sup  `xml:"Sup,omitempty"`
	Sub     []Sub  `xml:"Sub,omitempty"`
}

TableHeaderColumn represents a table header column

type TableHeaderRow

type TableHeaderRow struct {
	TableHeaderColumn []TableHeaderColumn `xml:"TableHeaderColumn"`
}

TableHeaderRow represents a table header row

type TableRow

type TableRow struct {
	TableColumn []TableColumn `xml:"TableColumn"`
}

TableRow represents a table row

type TableStruct

type TableStruct struct {
	TableStructTitle *TableStructTitle `xml:"TableStructTitle,omitempty"`
	Table            Table             `xml:"Table"`
	Remarks          []Remarks         `xml:"Remarks,omitempty"`
}

TableStruct represents a table structure

type TableStructTitle

type TableStructTitle struct {
	WritingMode WritingMode `xml:"WritingMode,attr,omitempty"`
	Content     string      `xml:",chardata"`
	Line        []Line      `xml:"Line,omitempty"`
	Ruby        []Ruby      `xml:"Ruby,omitempty"`
	Sup         []Sup       `xml:"Sup,omitempty"`
	Sub         []Sub       `xml:"Sub,omitempty"`
}

TableStructTitle represents a table structure title

type TextNode added in v0.0.5

type TextNode struct {
	Text string
}

TextNode represents plain text in mixed content

func (TextNode) HTML added in v0.0.5

func (t TextNode) HTML() string

HTML returns HTML-escaped text

func (TextNode) IsRuby added in v0.0.5

func (t TextNode) IsRuby() bool

IsRuby returns false for text nodes

func (TextNode) String added in v0.0.5

func (t TextNode) String() string

String returns the plain text

type WritingMode

type WritingMode string

WritingMode represents text direction

const (
	WritingModeVertical   WritingMode = "vertical"
	WritingModeHorizontal WritingMode = "horizontal"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL